import React, { Component } from 'react';
import { Button, message } from 'antd';
import IPApi from '@/api/index';
class Http extends Component {
  constructor(props) {
    super(props);
    this.state = {
      ipAddress: {}
    };
  }
  async getIp() {
    let res = await IPApi.getIpAddress('125.23.27.5');
    message.success('查询IP成功');
    this.setState({
      ipAddress: res.data.data
    });
  }
  render() {
    return (
      <div>
        <div>{JSON.stringify(this.state.ipAddress)}</div>
        <Button onClick={() => this.getIp()}>网络请求</Button>
      </div>
    );
  }
}

export default Http;
